{% extends "template_base.html" %}
{% block title %}DeepyWeb - Log in or log up!{% endblock %}

{% block script %}
    <script>
        $(function () {
            var text = document.getElementById("my_alert").textContent;
            if (text != '') {
                alert(text);
            }
        });

    </script>
{% endblock %}
{% block navbar %}
    <nav id="navbar" class="navbar">
        <ul>
            <!--<li><a class="nav-link scrollto active " href="#header">Home</a></li>-->
            <li><a class="nav-link scrollto" href="/welcome">主 页</a></li>
            {% if not logged %}
                <li><a class="getstarted scrollto" href="login">登 录</a></li>
            {% endif %}
            {% if logged %}
                <li><a class="getstarted scrollto" href="logout">登 出</a></li>
            {% endif %}

        </ul>
        <i class="bi bi-list mobile-nav-toggle"></i>
    </nav><!-- .navbar -->
{% endblock %}

{% block main %}
    <main id="main">
        <span id="my_alert" style="display:none;">{{my_alert}}</span>
        <!-- ======= Breadcrumbs ======= -->
        <section class="breadcrumbs">
            <div class="container">
                <ol>
                    <li><a href="/welcome">Home Page</a></li>
                </ol>
                <h2>Query Results</h2>
            </div>
        </section>
        <!-- End Breadcrumbs -->

        <section class="inner-page">
            <div class="container">

                <!-- Outer Row -->
                <div class="register-form">
                    <div class="col-xl-10 col-lg-12 col-md-9" style="margin: 0 auto">
                        <div class="card o-hidden border-0 shadow-lg my-5">
                            <div class="card-body p-0">
                                <!-- Nested Row within Card Body -->
                                <div class="p-5">
                                    <div class="text-center">
                                        <h2>历 史 记 录</h2>
                                    </div>
                                    <br>
                                    <div class="app-expense-grid__item-24 expense-order-table">
                                        <div class="app-expense-grid__box">
                                            <div class="app-expense-table app-expense-table--bordered">
                                                <div class="app-expense-table__header">
                                                    <table class="app-expense-table__box" style="width: 100%">
                                                        <colgroup>
                                                            <col style="width: 10%;">
                                                            <col style="width: 20%;">
                                                            <col style="width: 10%;">
                                                            <col style="width: 20%;">
                                                            <col style="width: 20%;">
                                                            <col style="width: 20%;">
                                                        </colgroup>
                                                        <thead>
                                                        <tr>
                                                            <th class="">
                                                                <div style="text-align:center"><span class="app-expense-text-overflow"
                                                                           title="TaskRuntimeID">运行时ID</span></div>
                                                            </th>
                                                            <th class="">
                                                                <div style="text-align:center"><span class="app-expense-text-overflow" title="TaskType">任务类型</span>
                                                                </div>
                                                            </th>
                                                            <th class="">
                                                                <div style="text-align:center"><span class="app-expense-text-overflow"
                                                                           title="Status">状态</span></div>
                                                            </th>
                                                            <th class="">
                                                                <div style="text-align:center"><span class="app-expense-text-overflow"
                                                                           title="StartTime">开始时间</span></div>
                                                            </th>
                                                           <th class="">
                                                                <div style="text-align:center"><span class="app-expense-text-overflow"
                                                                           title="EndTime">结束时间</span></div>
                                                            </th>
															<th class="">
                                                                <div style="text-align:center"><span class="app-expense-text-overflow"
                                                                           title="Result">结果</span></div>
                                                            </th>
                                                            
                                                        </tr>
                                                        </thead>
                                                    </table>
                                                </div>
                                                <hr>
                                                <div class="app-expense-table__body">
                                                    <table class="app-expense-table__box" style="width: 100%">
                                                        <colgroup>
                                                            <col style="width: 10%;">
                                                            <col style="width: 20%;">
                                                            <col style="width: 10%;">
                                                            <col style="width: 20%;">
                                                            <col style="width: 20%;">
                                                            <col style="width: 20%;">
                                                        </colgroup>
														
                                      
                                                        <tbody>
														{% for result in results %}
                                                        <tr class="">
                                            
                                                            <td class="">
                                                                <div style="text-align:center"><span
                                                                           title="RuntimeID">{{ result['runtime_id'] }}</span>
                                                                </div>
                                                            </td>
															
                                                            <td class="">
                                                                <div style="text-align:center"><span title="TaskType">{{ result['task_type'] }}</span> </div>
                                                            </td>
															
                                                            <td class="">
                                                                <div style="text-align:center"><span  title="Status">{{ result['status'] }}</span> </div>
                                                            </td>
															
                                                            <td class="", title="StartTime">
                                                                <div style="text-align:center">{{ result['start_time'] }}</div>
                                                            </td>
															
                                                            <td class="", title="EndTime">
                                                                <div style="text-align:center">{{ result['end_time'] }}</div>
                                                            </td>
															
                                                            <td class="" title="Result">
                                                                <div style="text-align:center"><a href="{{ result['download_path'] }}">点击此处进行下载</a></div>
                                                            </td>
                                  
                                                        </tr>
														{% endfor %}
                                                        </tbody>
														
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <br>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>
    <!-- End #main -->
{% endblock %}
